import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VipOrderVO, VipOrderForm, VipOrderQuery } from '@/api/system/vipOrder/types';

/**
 * 查询会员订单列表
 * @param query
 * @returns {*}
 */

export const listVipOrder = (data?: VipOrderQuery): AxiosPromise<VipOrderVO[]> => {
  return request({
    url: '/system/vipOrder/list',
    method: 'post',
    data
  });
};

/**
 * 查询会员订单详细
 * @param id
 */
export const getVipOrder = (id: string | number): AxiosPromise<VipOrderVO> => {
  return request({
    url: '/system/vipOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增会员订单
 * @param data
 */
export const addVipOrder = (data: VipOrderForm) => {
  return request({
    url: '/system/vipOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改会员订单
 * @param data
 */
export const updateVipOrder = (data: VipOrderForm) => {
  return request({
    url: '/system/vipOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除会员订单
 * @param id
 */
export const delVipOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/vipOrder/' + id,
    method: 'delete'
  });
};
